From d30ab7423830e66a07c0bb2190e34d7ea1af6421 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 12 Dec 2022 14:58:38 +0100 Subject: [PATCH] luci-base: fix button handling for named sections If more than one named section is added to the page, it is currently the case, that the first button is always switched on or off during input validation of the uci section name. This is because the usage of the 'document.querySelector' function is to imprecise. Changing the search start to the element to be created, fixes this. Signed-off-by: Florian Eckert (cherry picked from commit 440a2e79a762b4152ccb7e41c90a2826d9fb3538) --- modules/luci-base/htdocs/luci-static/resources/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index b0deea8e8f..2d9fbfa79f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -2219,7 +2219,7 @@ var CBITypedSection = CBIAbstractSection.extend(/** @lends LuCI.form.TypedSectio if (this.map.readonly !== true) { ui.addValidator(nameEl, 'uciname', true, function(v) { - var button = document.querySelector('.cbi-section-create > .cbi-button-add'); + var button = createEl.querySelector('.cbi-section-create > .cbi-button-add'); if (v !== '') { button.disabled = null; return true; -- 2.30.2